﻿using System;
using System.Web.Mvc;
using System.Web.Routing;
using TinyCms.Infrastructure.Ioc;

namespace TinyCms.Controllers.Core
{
    public class XiJiuControllerFactory : DefaultControllerFactory
    {
        protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
        {
            if (controllerType == null)
            {
                return null;
            }
            //一般控制器命名以Controller结尾，若不遵循此规则，可在Spring.xml中具体修改注册的Controller name属性
            return ServiceLocator.Instance.GetObject<IController>(controllerType.Name.Replace("Controller", ""));

        }

        
    }
}
